#include "pch.h"
#include "Typography.h"
#include "Helper.h"
#include "ErrorCodes.h"
#include "Factories.h"
#include "TextFormat.h"

using namespace Platform;
using namespace Microsoft::WRL;

using namespace DXBase;
using namespace DXBase::DWrite;


Typography::Typography()
{
	HR2Ex(Factories::GetDWriteFactory()->CreateTypography(pTypo.GetAddressOf()));
}
void Typography::AddFontFeature(FontFeature ff)
{
	DWRITE_FONT_FEATURE dff = { static_cast<DWRITE_FONT_FEATURE_TAG>(ff.NameTag), ff.Parameter };
	HR2Ex(pTypo->AddFontFeature(dff));
}
FontFeature Typography::GetFontFeature(uint32 i)
{
	DWRITE_FONT_FEATURE dff;
	HR2Ex(pTypo->GetFontFeature(i, &dff));
	FontFeature result = { static_cast<FontFeatureTag>(dff.nameTag), dff.parameter };
	return result;
}
uint32 Typography::FontFeatureCount::get()
{
	return pTypo->GetFontFeatureCount();
}
